<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<meta http-equiv="pragma" content="no-cach" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />

<title>player</title>
<style>
body{margin:0px; overflow:hidden; background-color:#010101;}
li{list-style-type: decimal;}
@font-face {
				font-family: 'inconsolata';
				src: url('../$inc/inconsolata.woff') format('woff');
				font-weight: normal;
				font-style: normal;
			}
 
</style>
<script src="../$inc/tools.build.js?a=<?php echo rand(0,999999);?>" type="text/javascript"></script>
<script src="./public/jquery-2.1.1.js"></script>
<script src="./core/TOOLS.Status.js?a=<?php echo rand(0,999999);?>"></script>
<script src="./core/mouse.js"></script>
<script src="./core/Video.lib.js?a=<?php echo rand(0,999999);?>"></script>
<script src="./core/initPage.js?a=<?php echo rand(0,999999);?>"></script>

<!--音量插件头文件-->
<script src="./core/plug_volume.js?a=<?php echo rand(0,999999);?>"></script>
 
 
<!--歌词插件头文件-->
<script src="./core/_subtitle_H.js?a=<?php echo rand(0,999999);?>"></script>
<script src="./core/plug_subtitle.js?a=<?php echo rand(0,999999);?>"></script>
<script>

<?php
/*fileName: 
 *internal version: 0001
 *version : 1.0.0 [programming] [official version]
 *author : HeShengyu
 *Date : 2014.07.21 
 *email: koolfer@163.com
 *end date:2014.08.23
 *http://www.cnblogs.com/ssnowy/
*/
?>
  <?php
  //php代码放到script标签就不会不空白现象出现
 
require_once 'appInc.php';
 
 
 $g_arrfiles=array();
 function ListDir_VIDEO ($dirname,$DIR='/VPLIST/')   
{   global $g_arrfiles;
    $Ld = dir($dirname);   
   // echo "<ul>";   
    while (false !== ($entry = $Ld->read())) {   
        $checkdir=$dirname."/".$entry;   
        if (is_dir($checkdir)&&!preg_match("[^\.]",$entry)){   
          // echo "<li><span style= 'color:#33cc33'>".$checkdir."</span></li>";   
          // ListDir($checkdir);   
        }else{   
			if(!preg_match("[^\.]",$entry)){
				if(
				preg_match  (
			"/(\.mp4)$/i",$entry  )
			&& (    !preg_match("/del(\.mp4)$/",$entry)  )  
				 ){
						$src="http://".$_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$DIR.$entry;
						$src=str_replace("#","%23",$src);
						//$src=iconv('GB2312','UTF-8',$src);
					  //  echo "<li><a href='".$src."' target=_blank>".$src."</a></li>";  
				   // $g_arrfiles[]=$dirname."".$entry;
				   $g_arrfiles[]=$src;
				  }
			}
         }   
    }   
    $Ld->close();   
   // echo "</ul>";   
}
 
ListDir_VIDEO (__FILE__."/../../../__VideoR/V_xyxm/","/__VideoR/V_xyxm/");
if(0==count($g_arrfiles)){
 
echo " 
TOOLS.ready(function() {
	mkTrace('没有视频文件');
	
})";
echo "</script>";
exit('没有视频');	
}
//把自己生成一个html文件
 //generation_selfhtml(date('_Y-m-d H_',time()));
 
// $tableEx=new Cltable();
 
 
// $tableEx->export($g_arrfiles);
 
$VIDEO=$g_arrfiles[  array_rand($g_arrfiles,1)   ];
 
 $VIDEO=iconv('GBK//IGNORE','UTF-8//IGNORE',$VIDEO);
//echo str_replace("{VIDEO}",$VIDEO,  _frdf('VID_MB.html')  );


?>

window.subtitle=
[{"s":1000,"e": 12800,"lyric":"Windows程序设计（SDK）<br>(38份评价)<br>讲师：小甲鱼<br>发布者：鱼C工作室<br>分类： IT/互联网 编程语言 操作系统<br>"} 
 
]
window._subtitle=Object.create(window.subtitle);
TOOLS.ready(function() {
	
	
	//调整视频宽高模式
     window.heightMode!==true
	window.videoInfo.width =235 ;
	window.videoInfo.height = 100;
	
	
	//视频随机播放 mode 为 1  顺序播放为 2
	window.Ctrler={ mode : 1 }
    window.oPlayer = new PLAYER()
	window.setTimeout(function(){
	oPlayer.player().volume-=0.6;
	},10);//不延时的话会报错的
    oPlayer.mkVideo('<?php echo $VIDEO;?>')
    //oPlayer.mkVideo('/VPLIST_MIN/03 火凤天舞-混合文件.mp4')

    window.sta = new Status('idfps'
            ,'color:#ff0;font-size:50px;width:auto;font-family:"思源黑体 CN Light";'
            +';position:fixed;left:10px;top:10px;display:none; border-radius: 5px;padding:0px;'
            +'z-index:20;background-color:#000; width:50px;'
    )
    sta.freq=1000;
    sta.setdraw(function(){
        document.getElementById('info').innerHTML=TOOLS.getLocalTime()
		//+window.g_paly_staus
		+' '+mathExt.to60(oPlayer.player().currentTime)
		+'/'+mathExt.to60(oPlayer.player().duration)
    })
	sta.stop=true;
    sta.run();

    oPlayer.player().oncanplay=function(){
        oPlayer.player().play();
        // mkTrace('canplay')
		  
    }
    oPlayer.player().onended=function(){
        // mkTrace('onended')
    }
	
	 oPlayer.player().onerror=function(){
        oPlayer.player().play();
          mkTrace('error')
		  
    }
	  	
	 //插件加载器
    window.initPlugs =  function (){
	 //一，添加音量插件
     window.pv = new plug_volume.mkVolDiv('g_');	  
	 window.pv.run();	
	 
	 //二，运行歌词字幕			 
	 tre.trace('runPlugLyric()','green',20)	 
	 //创建歌词插件	 
	 window.oLyric = new PlugLyric(window.oPlayer);
	 
	 //创建装歌词的盒子 Ctrace对象
     window.oLyTrace = new CtraceForSubTitle();
     oLyTrace.isKillTrace =false;
     oLyTrace.traceBgColor ="#f06;";
	 
	 //取出歌词
	 window.setInterval(
	     function(){
	     oLyric.draw(oLyTrace)}
		 ,
	 100)
	 
	 window.getLyrJSON()
	 
	 window.oLyric.isShowSubtitle = 0;
	 Ctrler.mode=2
	 
	 
	 //
	 
		
	}    
    initPlugs();    
          
     oPlayer.player().setAttribute('height',window.innerHeight+'px')	
		   oPlayer.player().setAttribute('width','')	     
    

	window.loopworld.Singleloop =false
	//设置当前的视频是否播放结束
	window.loopworld.ended = false
	loopworld()
	
	
 
	
	window.VideoArray=__getVideoArray();
	console.log(VideoArray);
	//打乱数组
	window.VideoArrayShuffle=VideoArray.__$shuffle$__();
	window.aList = window.VideoArrayShuffle.__$clone$__()
	
	window.randPlay=function( ){
		var ret;
		if(Ctrler.mode ===  1 ||(Ctrler.mode !==2)&&Ctrler.mode !==3  ){
	 var r = window.aList.__$rselect$__(window.VideoArrayShuffle);
	  setsrc(r[0]);
	 console.log(window.aList.length)
	 console.log(r[0])
	 tre.traceOne(window.aList.length+','+r[0],false)
	 ret = r[0];
	 console.log('rand播放')
		}else if(Ctrler.mode === 2) {
		 ret=VideoArray.__$sequSe$__()	
		 setsrc(ret);
		 console.log('顺序播放'+VideoArray.curr+'/'+(VideoArray.length-1))
		  console.log(ret)
		} else if(Ctrler.mode === 3) {
		 ret=VideoArray.__$sequSeUp$__()	
		 setsrc(ret);
		 console.log('顺序播放上一曲')
		  console.log(ret)
		}
	 return ret;
	}
	//for(var i=0 ;i<66;i++){
	//randPlay()
	//}
     console.log( randPlay() );
	  
 window.setHeight=function(){
		
	   
var ev = ev || window.event  ||  arguments.callee.caller.arguments[0]/*支持火狐*/ ;
	 
        
		 
		TOOLS.Cevent.getAsc( ev );
		 
	 	if(TOOLS.Cevent.eventCode===('C').charCodeAt(0)){
			
		   oPlayer.player().setAttribute('height',window.innerHeight+'px')	
		   oPlayer.player().setAttribute('width','')	
	 	}
		if(TOOLS.Cevent.eventCode===('V').charCodeAt(0)){
			
		   oPlayer.player().setAttribute('height','')	
		   oPlayer.player().setAttribute('width',window.innerWidth+'px')	
		}
		 if(TOOLS.Cevent.eventCode===('X').charCodeAt(0)){
			
		   oPlayer.player().setAttribute('width','')	
		   oPlayer.player().setAttribute('height', (parseInt(oPlayer.player().height)+50)+'px')
		}
		
		if(TOOLS.Cevent.eventCode===('U').charCodeAt(0)){
		   
			
			 window.videoScaleArr.__$sequSe$__()() 
			 PLAYER.changeVideoWidthAndHeight();
		    
		}
		
	   PLAYER.changeVideoWidthAndHeight();
		 
		 
		 
	}
	window.addEventListener('keyup',window.setHeight,false);
	
	//设置视频居中
	PLAYER.changeVideoWidthAndHeight();
	
	
	 window.videoScaleArr = new Array(
			function(){
		    window.parent.setVideoInfoWH(16,9)},
			function(){
			window.parent.setVideoInfoWH(4,3)},
			function(){
			window.parent.setVideoInfoWH(16,10)},
			function(){
			window.parent.setVideoInfoWH(5,4)},
			function(){
			window.parent.setVideoInfoWH(16,8)}
		   
		   
			
			) 
		
})
var px=0;
</script>
<script>
 

window.locklist=true;
 
 
</script>
<style>
a{color:#fff;}
</style>
</head>

<body>
<div id='videolist' style="z-index:200; position:absolute; background-color:#f09;color:#fff; width:900px; overflow-x:hidden; overflow-y: scroll; height:100%; border-radius:5px;padding:0px; display:none;filter: alpha(opacity = 70);opacity: .7;">
<?php
$icount =1;
foreach($g_arrfiles as $v){
	$v=iconv('GBK//IGNORE','UTF-8//IGNORE',$v) ;
	echo '<li><a href="javascript:window.setsrc(\''.$v.'\' ,' .$icount.' )" title="'.$v.'">'.$v.'</a></li>';
    $icount++;
}
?>
</div>
</body>
</html> 